package com.xc.ezplan.core.enums;

import com.xc.ezplan.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lixingchen
 * @date 2022/12/07
 * @description 腾讯云地域简称
 */
@Getter
@AllArgsConstructor
public enum  TencentRegionEnum {
    /**
     *  腾讯云各个服务器地址与地域简称对应关系
     */
    BEI_JING("北京", "ap-beijing"),
    NAN_JING("南京", "ap-nanjing"),
    SHANG_HAI("上海", "ap-shanghai"),
    GUANG_ZHOU("广州", "ap-guangzhou"),
    CHENG_DU("成都", "ap-chengdu"),
    CHONG_QING("重庆", "ap-chongqing");

    private final String zhName;
    private final String region;

    public static String find(String zhName) {
        for (TencentRegionEnum value : TencentRegionEnum.values()) {
            if (value.getZhName().equals(zhName)) {
                return value.getRegion();
            }
        }
        return StringUtils.EMPTY;
    }

    public static List<String> regions(){
        List<String> result = new ArrayList<>();
        for (TencentRegionEnum value : TencentRegionEnum.values()) {
            result.add(value.getRegion());
        }
        return result;
    }
}
